<template>
  <div>
    <div class="top">
      <Top />
    </div>
    <div>
      <el-container>
        <el-aside class="SidebarLeft">
          <Sidebar />
        </el-aside>
        <el-main class="tableRight">
          <router-view />
        </el-main>
      </el-container>
    </div>
  </div>
</template>

<script setup>
  import Sidebar from "@/components/backend/Sidebar";
  import Top from "@/components/backend/Top";
  import {onMounted} from "vue";
  import {ElMessage} from "element-plus";
  import {getBackendName, getBackendType} from "@/utils/auth";
  import {useRouter} from "vue-router";

  const router = useRouter();

  onMounted(() => {
    if (getBackendName() !== null) {
      ElMessage.success("欢迎"+getBackendName()+"登录");
    }

    if (getBackendType() === "super") {
      router.push({
        path: "/backend/adminList/super"
      })
    } else {
      router.push({
        path: "/backend/authorList"
      })
    }
  })

</script>

<style scoped lang="scss">
* {
  padding: 0;
  margin: 0;
}
.top {
  position: relative;
  top: 0;
  z-index: 10;
}
.SidebarLeft {
  width: 217px;
  height: 86.5vh;
}
.tableRight {
  width: 100%;
  height: 86.5vh;
}
</style>